#include <fhe/core/NodeInterfaceRegisterer.h>
#include <fhe/core/NodeInterface.h>

namespace fhe
{
  namespace core
  {
    NodeInterfaceRegisterer::NodeInterfaceRegisterer( const std::string& module, const std::string& name )
    {
      NodeFactory::instance().addNodeInterface( INodeInterface::Ptr( new NodeInterface( module, name ) ) );
    }
    
    NodeInterfaceRegisterer::NodeInterfaceRegisterer( const std::string& nodeModule, const std::string& nodeName, const std::string& interfaceModule, const std::string& interfaceName )
    {
      FHE_ASSERT_MSG( NodeFactory::instance().hasNodeDesc( nodeModule, nodeName ), 
                      "unable to add interface %s.%s to unknown node %s.%s", 
                      interfaceModule.c_str(), interfaceName.c_str(), 
                      nodeModule.c_str(), nodeName.c_str() );
      NodeFactory::instance().getNodeDesc( nodeModule, nodeName )->addNodeInterface( interfaceModule, interfaceName );
    }
  }
}
